package com.sykj.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;


public class MD5Util {
	
	static final String hashAlgorithmName = "MD5";
	static final int hashIterations = 5;
	
	public static String jiami(String username , String password) {
		//根据用户名获得盐值
		ByteSource salt = ByteSource.Util.bytes(username);
		Object result = new SimpleHash(hashAlgorithmName, password, salt, hashIterations);
		System.out.println("加密后的密码为"+result);
		return result.toString();
	}
	
	public static void main(String[] args) {
		jiami("super", "super");
	}
}
